home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 352_01 / vldtpath.cpp < prev    next >
C/C++ Source or Header  |  1991-04-22  |  749b  |  39 lines

  1. /* VLDTPATH.C - contains validate_path()
  2.  *        general purpos function to validate data paths
  3.  *        PARM may be either NULL or C:\path\
  4.  *        specified path must exist and not be empty.
  5.  *        RETURNS: -1 if not valid, 0 if valid.
  6.  */
  7. #include <stdlib.h>
  8. #include <string.h>
  9. #include <dir.h>
  10.  
  11. #include "dblib.h"
  12.  
  13.  
  14. int validate_path ( char *path )
  15.     {    
  16.     int retcode = 0;
  17.     char far *savedta; 
  18.     struct ffblk ffb;
  19.  
  20.     String *fullnm = make_fullfilename ( path, "*.*" );
  21.     
  22.     savedta = getdta ();
  23.     if ( -1 == findfirst ( (*fullnm), &ffb, FA_DIREC ) )
  24.         {
  25.         errno =0;
  26.         retcode = -1;
  27.         }
  28.     delete fullnm;    
  29.     setdta (savedta);
  30.     return (retcode);
  31.     }
  32.     
  33.     
  34.     /*----------------------- VLDTPATH.CPP -----------------------------*/
  35.         
  36.     
  37.     
  38.     
  39.